; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -opaque-pointers -atomic-expand -S -mtriple=powerpc64le-unknown-unknown \
; RUN:   %s | FileCheck %s
; RUN: opt -opaque-pointers -atomic-expand -S -mtriple=powerpc64-unknown-unknown \
; RUN:   %s | FileCheck %s

define ptr @foo(ptr %p) {
; CHECK-LABEL: @foo(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP0:%.*]] = load atomic ptr, ptr [[P:%.*]] monotonic, align 8
; CHECK-NEXT:    call void @llvm.ppc.cfence.p0(ptr [[TMP0]])
; CHECK-NEXT:    ret ptr [[TMP0]]
;
entry:
  %0 = load atomic ptr, ptr %p acquire, align 8
  ret ptr %0
}

define void @foobar(ptr addrspace(11) %p) {
; CHECK-LABEL: @foobar(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP0:%.*]] = load atomic ptr addrspace(10), ptr addrspace(11) [[P:%.*]] monotonic, align 8
; CHECK-NEXT:    call void @llvm.ppc.cfence.p10(ptr addrspace(10) [[TMP0]])
; CHECK-NEXT:    unreachable
;
entry:
  %0 = load atomic ptr addrspace(10), ptr addrspace(11) %p acquire, align 8
  unreachable
}
